*
* Table B1: Demographics, socioeconomic status, academic achievement and dominated choices: Relevant applicants
*
* Input table: 
*	"${data_applicant_level_tidy}"
*
* Output file: 
*	/results/TableB1.tex
*

use "${data_applicant_level_tidy}", clear

* Restrict to the eligible sample
keep if eligibility == 1 & any_ba_listed == 1 & no_funded_version_at_all == 0

do "${helpers_dir}/addVariablesForRegressionAnalysis.do"

keep if ROL_state_funded_only == 0

local demography female female_missing voc_school other_school countycapital town village i.year

qui reg dominated_choice unempl_rate unempl_missing GPA11_std GPA11_missing `demography', r
est store est_1

qui reg dominated_choice grossincome grossincome_missing GPA11_std GPA11_missing `demography', r
est store est_2

qui reg dominated_choice disadv GPA11_std GPA11_missing `demography', r
est store est_3

esttab est_1 est_2 est_3 ///
	using "${result_dir}/TableB1.tex", ///
	drop(_cons *_missing) b(3) se(3) r2 indicate("Year FE = *year") ///
	stat(r2, fmt(%18.2g) ///
	labels("R-squared")) ///
	label star(* 0.10 ** 0.05 *** 0.01) replace noomitted nogaps f noobs ///
	nomtitles nonumbers nolines ///
	order(unempl_rate grossincome disadv GPA11_std voc_school other_school countycapital town village female)

* ------------------------------------------------------------------------------	
* Table notes:
qui sum GPA11_missing
di "The sample includes " round(r(N)) " ROLS."
di "Eleventh-grade GPA is missing for " round(r(mean)*100, 0.1) " percent of the sample"

qui sum dominated_choice
di "The share of dominated choices is " round(r(mean)*100, 0.1) " percent in the relevant subsample."
